from collections import Iterable
# 迭代，无论有无下标，都可以迭代
d = {'a': 1, 'b': 2, 'c': 3}
for key in d:  # 迭代key
    print(key)
for value in d.values():  # 迭代value
    print(value)
for k, v in d.items():  # 迭代key和value
    print(k, v)
for char in 'too':
    print(char)

print(isinstance('abc', Iterable))
print(isinstance(123, Iterable))
# enumerate 可以把一个list变成索引-元素对
for i, value in enumerate(['whe', 'are', 'you', '?']):
    print(i, value)
# 可同时引用两个变量
for x, y in [(1, 2), (2, 3), (3, 4), (4, 5)]:
    print(x, y)
